

package com.example.administrator.caigou51.recyclerCard.cardView;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import com.example.administrator.caigou51.R;
import com.example.administrator.caigou51.activity.SearchGoodsActivity;
import com.example.administrator.caigou51.recyclerCard.basic.CardItemView;
import com.example.administrator.caigou51.recyclerCard.card.SortRightCard;


public class SortRightCardView extends CardItemView<SortRightCard> {
 	private Context mContext;
    private TextView textView_sort;
    public SortRightCardView(Context context) {
        super(context);
        mContext=context;
        // TODO Auto-generated constructor stub
    }

    public SortRightCardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext=context;
        // TODO Auto-generated constructor stub
    }

    public SortRightCardView(Context context,
                             AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        mContext=context;
        // TODO Auto-generated constructor stub
    }

    @Override
    public void build(final SortRightCard card) {
        // TODO Auto-generated method stub
        super.build(card);
        textView_sort= (TextView) findViewById(R.id.textView_sort);
        if (card.getSecondcatEntity()!=null && card.getSecondcatEntity().getCatname()!=null) {
            textView_sort.setText(card.getSecondcatEntity().getCatname());
            textView_sort.setVisibility(View.VISIBLE);
        }else
        {
            textView_sort.setVisibility(View.GONE);
        }
        setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, SearchGoodsActivity.class);
                intent.putExtra(SearchGoodsActivity.SearchTagID,card.getSecondcatEntity().getCatid());
                mContext.startActivity(intent);
            }
        });
    }
  /*  private void  taskGetGoodsBeanList()
    {

        RequestServerManager.getInstanceDIY().handleMethodDIY((GBaseActivity) mContext, null, false, null,
                Constant.getRootUrl() + Constant.Action.Action_SortGoodsList, Constant.Action.Action_SortGoodsList, RequestServerManager.getInstanceDIY().
                        getRequestParams(Constant.Action.Action_SortGoodsList), BaseResponse.class, new ICallBackForRequestServer<BaseResponse>() {
                    @Override
                    public void onSuccess(BaseResponse result) {
                        // JSONObject jsonObject = (JSONObject) result.getData();
                        List<GoodsBean> goods = JSON.parseObject(result.getData().toString(), CategoryBean.class);
                        fillArrayInListView(categoryBean);

                    }

                    @Override
                    public void onFail(int type, String errorMsg, String json) {

                    }
                });

    }*/
}
